Page({
  data: {
    isLike: true,
    // banner
    indicatorDots: true, //是否显示面板指示点
    autoplay: true, //是否自动切换
    interval: 3000, //自动切换时间间隔,3s
    duration: 1000,//	滑动动画时长1s
    imgUrls: [
      'https://img14.360buyimg.com/n1/s450x450_jfs/t1/26776/22/21058/45074/669d2499Fc24bfa53/79706ec00c489036.jpg.avif',
      'https://img13.360buyimg.com/n1/s450x450_jfs/t1/6016/35/36492/41859/669d249aF8e6ae026/10339f9eb4558cd3.jpg.avif',
      'https://img13.360buyimg.com/n1/s450x450_jfs/t1/234867/37/24485/39672/66be0650F2b3a7db5/40f3db0c24ddc912.jpg.avif',
      'https://img10.360buyimg.com/n1/s450x450_jfs/t1/9477/1/26962/39646/66be064fF0f7ad0d4/87a22ff80060941f.jpg.avif',
      'https://img10.360buyimg.com/n1/s450x450_jfs/t1/249087/36/15660/43263/669d249aF6a7d01d5/c848aa181926cf3f.jpg.avif'
    ],


    // 商品详情介绍
    detailImg: [
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/248752/24/15512/127971/669a3b7aF26bb7c84/251d4bf7941e62a2.jpg.avif",
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/61046/30/25851/96593/669a3b7aF99ce84cd/43e9128efcaf16d0.jpg.avif",
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/190929/8/45554/127419/669a3b78F7a7733d5/fbe91da177880462.jpg.avif",
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/227654/34/24071/73285/669a3b77F1c6d7d57/0064486bef1678ca.jpg.avif",
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/27936/12/20459/62071/669a3b79Fbeb09634/470d79bea56798a4.jpg.avif",
      "https://img14.360buyimg.com/n1/s450x450_jfs/t1/230284/28/16417/65097/6616967bF4c21f251/579fdca6773bc0e1.jpg.avif",
    ],
  },
  //预览图片
  onLoad() {
    console.log(this.data.imgUrls); // 检查数据是否正常
  },
  previewImage(e) {
    wx.previewImage({
      current: e.currentTarget.dataset.src,
      urls: this.data.imgUrls

    })
  },
  // 收藏
  addLike() {
    this.setData({
      isLike: !this.data.isLike
    });
  },
  // 跳到购物车
  toCar() {
    wx.switchTab({
      url: '/pages/cart/cart'
    })
  },
  // 立即购买
  immeBuy() {
    wx.showToast({
      title: '购买成功',
      icon: 'success',
      duration: 2000
    });
  },
})
